<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html>
<head>
    <title>修改商品信息</title>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/4.3.1/css/bootstrap.min.css">
    <script src="https://cdn.staticfile.org/jquery/3.2.1/jquery.min.js"></script>
    <script src="https://cdn.staticfile.org/popper.js/1.15.0/umd/popper.min.js"></script>
    <script src="https://cdn.staticfile.org/twitter-bootstrap/4.3.1/js/bootstrap.min.js"></script>
</head>
<body>

<div class="container">
    <div class="card" style="width: 50%;margin: 50px auto 0 auto;">
        <form name="form1" action="${pageContext.request.getContextPath()}/Product" method="post"
              enctype="multipart/form-data">
            <div class="card-header">
                <a href="${header["referer"]}">
                    <svg t="1590586077033" class="icon" viewBox="0 0 1024 1024" version="1.1"
                         xmlns="http://www.w3.org/2000/svg" p-id="2683" xmlns:xlink="http://www.w3.org/1999/xlink"
                         width="20" height="20">
                        <defs>
                            <style type="text/css"></style>
                        </defs>
                        <path d="M221.2 465.728l182.416-182.416c18.024-18.024 17.984-47.28-0.08-65.352-18.08-18.064-47.336-18.104-65.36-0.08L77.104 478.96c-18.024 18.024-17.984 47.28 0.08 65.36l261.736 261.728c18.072 18.064 47.328 18.104 65.352 0.08s17.984-47.28-0.08-65.352L221.68 558.272h692.16c25.488 0 46.152-20.72 46.152-46.272s-20.664-46.272-46.152-46.272H221.192z"
                              p-id="2684"></path>
                    </svg>
                </a>修改商品信息
            </div>
            <div class="card-body">
                <div class="input-group mb-3">
                    <div class="input-group-prepend">
                        <span class="input-group-text">商品编号</span>
                    </div>
                    <input required="required" name="serialNumber" type="text" class="form-control"
                           value="${product.serialNumber}">
                </div>
                <div class="input-group mb-3">
                    <div class="input-group-prepend">
                        <span class="input-group-text">商品名称</span>
                    </div>
                    <input required="required" name="name" type="text" class="form-control" value="${product.name}">
                </div>
                <div class="input-group mb-3">
                    <div class="input-group-prepend">
                        <span class="input-group-text">商品品牌</span>
                    </div>
                    <input required="required" name="brand" type="text" class="form-control" value="${product.brand}">
                </div>
                <div class="input-group mb-3">
                    <div class="input-group-prepend">
                        <span class="input-group-text">商品型号</span>
                    </div>
                    <input required="required" name="model" type="text" class="form-control" value="${product.model}">
                </div>
                <div class="input-group mb-3">
                    <div class="input-group-prepend">
                        <span class="input-group-text">商品价格</span>
                    </div>
                    <input required="required" name="price" type="number" min="0.00" step="0.01" class="form-control"
                           value="${product.price}">
                </div>
                <div class="input-group mb-3">
                    <div class="input-group-prepend">
                        <span class="input-group-text">商品图片</span>
                    </div>
                    <img class="img" src="${pageContext.request.getContextPath()}/static/images/${product.picture}"
                         width="100" height="100">
                    <input name="file" class="imgInput btn  btn-outline-primary" type="file">
                </div>
                <span class="input-group-text">评论</span>
                <textarea name="description" class="form-control" id="comment" rows="5" placeholder="评论"
                          required="required">${product.description}</textarea>
            </div>
            <input type="hidden" name="tpicture" value="${product.picture}">
            <input type="hidden" name="productID" value="${product.productID}">
            <input type="hidden" name="op" value="modify">
            <div class="card-footer">
                <input type="submit" class="btn btn-outline-primary justify-content-center" value="修改">
            </div>
        </form>
    </div>
</div>

<script>
    $(".imgInput").change(function () {
        $(".img").attr("src", URL.createObjectURL($(this)[0].files[0]));
    });
</script>
</body>
</html>
<%--private int productID;          // 商品ID--%>
<%--private String serialNumber;    // 系列--%>
<%--private String name;            // 名称--%>
<%--private String brand;           // 品牌--%>
<%--private String model;           // 型号--%>
<%--private Double price;           // 价格--%>
<%--private String picture;         // 图片--%>
<%--private String description;     // 商品描述--%>